package club.emergency.wechat.dictionary.operate;

import club.emergency.wechat.model.dictionary.DictionaryChild;
import club.emergency.wechat.model.dictionary.DictionaryParent;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Create with IntelliJ IDEA
 * Project Name: business
 * Package Name: club.emergency.wechat_api.dictionary.operate
 * Date: 2018/11/26
 *
 * @author: 快乐的小菌菌
 * Description:
 */
public interface DictionaryOperate {

    /**
     * 新增父字典数据
     *
     * @param dictionaryParent 父字典pojo
     * @return 字符串型返回
     */
    @PostMapping("/dictionary-operate-provider/saveParent")
    String saveParent(@RequestBody DictionaryParent dictionaryParent);

    /**
     * 修改父字典数据(id不能为空)
     *
     * @param dictionaryParent 父字典pojo
     * @return 字符串型返回
     */
    @PostMapping("/dictionary-operate-provider/modifyParent")
    String modifyParent(@RequestBody DictionaryParent dictionaryParent);

    /**
     * 父字典数据删除
     *
     * @param id id
     * @return 字符串型返回
     */
    @PostMapping("/dictionary-operate-provider/removeParent")
    String removeParent(@RequestParam("id") Long id);

    /**
     * 新增子字典数据
     * 需要存缓存，缓存key为dictionary_keyName_parentId
     *
     * @param dictionaryChild 子字典pojo
     * @return 字符串型返回
     */
    @PostMapping("/dictionary-operate-provider/saveChild")
    String saveChild(@RequestBody DictionaryChild dictionaryChild);

    /**
     * 修改子字典数据(id不能为空)
     *
     * @param dictionaryChild 子字典pojo
     * @param keyName         父字典关键字
     * @return 字符串型返回
     */
    @PostMapping("/dictionary-operate-provider/modifyChild")
    String modifyChild(@RequestBody DictionaryChild dictionaryChild, @RequestParam("keyName") String keyName);

}
